Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

112
Visualizações
How can I decrease the numeric value of a property every time I click "confirm"?

I would like that every time I enter the right property name "title" of my class children and confirm, the available quantity of that title (initially set to 10), decreases.

I'm going crazy, what can I do?

class Catalog{
    #initial = 10;
    constructor(title){
        this.title = title;
    };
    get initial(){
        return this.#initial;
    };

    set initial(value){
        return this.#initial = this.initial - value;
    };
    
    amounts(){
        let search = prompt("Cerca il tuo dvd", "");
        let confirmed = confirm("Vuoi confermare l'acquisto?");
        
        
        if(search === this.title && confirmed){
          return this.initial - 1;    // ?????????         
        } 
        
    };
    

}



class Matrix extends Catalog{
    constructor(title){
        super(title);
        this.title = title;
    };
   
    
}

const x = new Matrix("Matrix");

console.log(x.amounts())
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda